import request from '@/config/axios'

export interface DirVO {
  id?: number
  name: string
  parentId: number
  status: number
  sort: number
  createTime: Date
}
// 查询目录（精简)列表
export const getSimpleDirList = async (): Promise<DirVO[]> => {
  return await request.get({ url: '/system/dept/simple-list' })
}
// 查询目录列表
export const getDirPage = async () => {
  return await request.get({ url: '/system/dept/list' })
}

// 查询目录详情
export const getDir = async (id: number) => {
  return await request.get({ url: '/system/dept/get?id=' + id })
}

// 新增目录
export const createDir = async (data: DirVO) => {
  return await request.post({ url: '/system/dept/create', data: data })
}

// 修改目录
export const updateDir = async (params: DirVO) => {
  return await request.put({ url: '/system/dept/update', data: params })
}

// 删除目录
export const deleteDir = async (id: number) => {
  return await request.delete({ url: '/system/dept/delete?id=' + id })
}
